<div class="ratings">
    <span id="stars_{{ product.id }}" class="stars" title="{% if request.user.is_authenticated %}{{ product.rating_stars|floatformat|default:0 }}{% else %}Log in to rate products{% endif %}">

        <span style="width: {% widthratio product.rating_stars|default:0 5 100 %}%;"></span>
    </span>
    <span class="rating_nocss">{{ product.rating_stars|default:0 }}</span>
    <span id="votes_{{ product.id }}" class="votes">({{ product.rating_votes }} vote{{ product.rating_votes|pluralize }})</span>
    <span id="userrating_{{ product.id }}" class="rating_data" title="{{ product.userrating|default:0 }}"></span>
    <noscript>
        <div class="rating_nojs">
            {% if request.user.is_authenticated %}
                <form method="post" action="{% url shop.views.rating.form_rate %}">
                    {% csrf_token %}
                    <div style="display: none;">
                        <input type="hidden" name="product_id" value="{{ product.id }}" />
                    </div>
                    <div>
                        <select name="rating">
                            <option {% if not product.userrating %} selected="selected"{% endif %} value="0">---</option>
                            <option {% if product.userrating == 1 %}selected="selected"{% endif %}>1</option>
                            <option {% if product.userrating == 2 %}selected="selected"{% endif %}>2</option>
                            <option {% if product.userrating == 3 %}selected="selected"{% endif %}>3</option>
                            <option {% if product.userrating == 4 %}selected="selected"{% endif %}>4</option>
                            <option {% if product.userrating == 5 %}selected="selected"{% endif %}>5</option>
                        </select>
                        <input class="rating_nojs_submit" type="submit" value="Rate" />
                    </div>
                </form>
            {% endif %}
        </div>
    </noscript>
</div>
